/// <reference path="../../sage/sage.util.js" />

var used = {};
var MapMarkerPainter = Base.extend({
    initialize: function initialize() { },
    paint: function paint(context) {
        var rect = context.gameObject.locationRelativeToCamera.objectRectangle,
            x = rect.x,
            y = rect.y,
            width = rect.w,
            height = rect.h;

        context.frontLayer.fillStyle = context.gameObject.textColor;
        context.frontLayer.fillText(context.gameObject.name, x, y - 5);
        //context.frontLayer.fillText(" [" + context.gameObject.locationRelativeToCamera.placement.x + "::" + context.gameObject.locationRelativeToCamera.placement.y + "]", x, y - 15);

        /*if (used[context.gameObject.name] == null) {
            used[context.gameObject.name] = true;
            console.log(context.gameObject.name + " [" + context.gameObject.locationRelativeToCamera.placement.x + "::" + context.gameObject.locationRelativeToCamera.placement.y + "]");
        }*/
        context.frontLayer.fillStyle = context.gameObject.color;
        context.frontLayer.beginPath();
        context.frontLayer.moveTo(x, y);
        context.frontLayer.lineTo(x + width, y);
        context.frontLayer.lineTo(x + width / 2, y + height);
        context.frontLayer.closePath();
        context.frontLayer.fill();
    }
});
